SpringAnimation

A spring-based [class@Animation].

AdwSpringAnimation implements an animation driven by a physical model of a spring described by [struct@SpringParams], with a resting position in [property@SpringAnimation:value-to], stretched to [property@SpringAnimation:value-from].

Since the animation is physically simulated, spring animations don't have a fixed duration. The animation will stop when the simulated spring comes to a rest - when the amplitude of the oscillations becomes smaller than [property@SpringAnimation:epsilon], or immediately when it reaches [property@SpringAnimation:value-to] if [property@SpringAnimation:clamp] is set to TRUE. The estimated duration can be obtained with [property@SpringAnimation:estimated-duration].

Due to the nature of spring-driven motion the animation can overshoot [property@SpringAnimation:value-to] before coming to a rest. Whether the animation will overshoot or not depends on the damping ratio of the spring. See [struct@SpringParams] for more information about specific damping ratio values.

If [property@SpringAnimation:clamp] is TRUE, the animation will abruptly end as soon as it reaches the final value, preventing overshooting.

Animations can have an initial velocity value, set via [property@SpringAnimation:initial-velocity], which adjusts the curve without changing the duration. This makes spring animations useful for deceleration at the end of gestures.

If the initial and final values are equal, and the initial velocity is not 0, the animation value will bounce and return to its resting position.

Constructors

this
this(AdwSpringAnimation* adwSpringAnimation, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(Widget widget, double from, double to, SpringParams springParams, AnimationTarget target)

Creates a new AdwSpringAnimation on @widget.

Members

Functions

getClamp
bool getClamp()

Gets whether @self should be clamped.

getEpsilon
double getEpsilon()

Gets the precision used to determine the duration of @self.

getEstimatedDuration
uint getEstimatedDuration()

Gets the estimated duration of @self.

getInitialVelocity
double getInitialVelocity()

Gets the initial velocity of @self.

getSpringAnimationStruct
AdwSpringAnimation* getSpringAnimationStruct(bool transferOwnership)

Get the main Gtk struct

getSpringParams
SpringParams getSpringParams()

Gets the physical parameters of the spring of @self.

getStruct
void* getStruct()

the main Gtk struct as a void*

getValueFrom
double getValueFrom()

Gets the value @self will animate from.

getValueTo
double getValueTo()

Gets the value @self will animate to.

getVelocity
double getVelocity()

Gets the current velocity of @self.

setClamp
void setClamp(bool clamp)

Sets whether @self should be clamped.

setEpsilon
void setEpsilon(double epsilon)

Sets the precision used to determine the duration of @self.

setInitialVelocity
void setInitialVelocity(double velocity)

Sets the initial velocity of @self.

setSpringParams
void setSpringParams(SpringParams springParams)

Sets the physical parameters of the spring of @self.

setValueFrom
void setValueFrom(double value)

Sets the value @self will animate from.

setValueTo
void setValueTo(double value)

Sets the value @self will animate to.

Static functions

getType
GType getType()

Variables

adwSpringAnimation
AdwSpringAnimation* adwSpringAnimation;

the main Gtk struct

Inherited Members

From Animation

adwAnimation
AdwAnimation* adwAnimation;

the main Gtk struct

getAnimationStruct
AdwAnimation* getAnimationStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
getState
AdwAnimationState getState()

Gets the current value of @self.

getTarget
AnimationTarget getTarget()

Gets the target @self animates.

getValue
double getValue()

Gets the current value of @self.

getWidget
Widget getWidget()

Gets the widget @self was created for.

pause
void pause()

Pauses a playing animation for @self.

play
void play()

Starts the animation for @self.

reset
void reset()

Resets the animation for @self.

resume
void resume()

Resumes a paused animation for @self.

skip
void skip()

Skips the animation for @self.

addOnDone
gulong addOnDone(void delegate(Animation) dlg, ConnectFlags connectFlags)

This signal is emitted when the animation has been completed, either on its own or via calling [method@Animation.skip].

Meta